package com.example.workflow.flow;

import lombok.Getter;

import java.util.LinkedHashMap;
import java.util.Map;


@Getter
public enum BizFlowTypeEnum {
    EXPENSE_APPROVE("Process_holiday","请假审批"),
    ORDER_APPROVE("Process_work_order","工单审批"),
    FIRST_APPROVE("Activity_0020xys","一级审批"),
    SECOND_APPROVE("Activity_11yk95q","二级审批"),
    OPERATE_ORDER("Activity_1bfkhq9","工单操作"),
    DISPATCH_ORDER("Activity_0g3bmup","是否派单"),
    HELP_ORDER("Activity_09ppnbu","协助操作"),
    MOPERATE_ORDER("Activity_1kf4bu3","主部门操作");
    private String key;
    private String value;
    BizFlowTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getValue(String key) {
        for (BizFlowTypeEnum c : BizFlowTypeEnum.values()) {
            if (c.getKey().equals(key)) {
                return c.getValue();
            }
        }
        return null;
    }

    public static String getKey(String value){
        for (BizFlowTypeEnum c : BizFlowTypeEnum.values()) {
            if (c.getValue().equals(value)) {
                return c.getKey();
            }
        }
        return null;
    }

    public static Map<String,String> getOption(){
        Map<String,String> option=new LinkedHashMap<>();
        for (BizFlowTypeEnum c : BizFlowTypeEnum.values()) {
            option.put(c.getKey().toString(),c.getValue());
        }
        return option;
    }

    public static BizFlowTypeEnum getEnum(String key){
        for (BizFlowTypeEnum c : BizFlowTypeEnum.values()) {
            if(c.getKey().equals(key)){
                return c;
            }
        }
        return null;
    }

}
